package cn.topcodes.tcsf.app.mapper;

import cn.topcodes.tcsf.app.domain.entity.AppClient;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.Date;
import java.util.List;

/**
 * APP客户端 Mapper
 * @author unicorn
 * @date 2017-11-13 22:06:58
 */
public interface AppClientMapper extends Mapper<AppClient> {

    @Select("select app from t_app_client group by app")
    List<String> findAllAppInfo();

    @Select("select platform from t_app_client group by platform")
    List<String> findAllAppPlatform();

    @Select("select app_version from t_app_client group by app_version")
    List<String> findAllAppVersion();

    @Select("select app_user_id from t_app_client where last_active_time >= #{0} and last_active_time <= #{1}" +
            " group by app_user_id")
    List<Long> findAllOnlineAccounts(Date startDate,Date endDate);

    @Select("select app_user_id from t_app_client where app=#{0} and last_active_time >= #{1} and last_active_time <= #{2} " +
            "group by app_user_id")
    List<Long> findAllOnlineAccountsByAppType(String apptype,Date startDate, Date endDate);

}
